home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 405_01 / dmanScanner.l < prev    next >
Text File  |  1993-07-17  |  10KB  |  220 lines

  1. /* @(#) dmanScanner.l LexSource asterisk 1.14 93/03/11 14:00:05 (SCCS/s.dmanScanner.l) */
  2. /*
  3.  * Nom du Fichier :     |>nom_fichier<|
  4.  * Titre :         |>Titre<|
  5.  * Auteur:        |>auteur<|        
  6.  * Date de creation :    |>dateCreation<|
  7.  */
  8. /* Description :
  9.  *    Document de reference : |>doc<|
  10.  *    Objet : |>objet<|
  11.  *
  12.  */
  13. /* 
  14.  * historique :
  15.  * |>date<|    |>auteur<|    |>objet<|
  16.  */
  17. /* -------------- declaration section -------------- */
  18. %s DANS_LIGNE
  19. %x DANS_COMMENT
  20. %name DmanScanner
  21. %{
  22. static char SccsId[]="@(#) dmanScanner.l LexSource asterisk 1.14 93/03/11 14:00:05 (SCCS/s.dmanScanner.l)";
  23. #include "dmanParser.h"
  24. #define YY_NULL 0
  25. #define YY_USER_ACTION BeginAction();
  26. %}
  27.  
  28. %define INHERIT
  29. %define LEX_RETURN int
  30. %define LEX ScanValue
  31. %define LEX_PARAM TokenValue &theValue
  32. %define MEMBERS  \
  33.     protected: \
  34.     int theLine,theColumn; \
  35.     void BeginAction(); \
  36.     virtual void SetDebug(int)=0;
  37. %define CONSTRUCTOR_PARAM void
  38. %define CONSTRUCTOR_INIT : theLine(1),theColumn(1)
  39. %define CONSTRUCTOR_CODE ;
  40. %define TEXT theText
  41. %define LENG theTextLength
  42.  
  43.  
  44.  
  45.  
  46. SPACES1 [ \t]+
  47. SPACES [ \t]*
  48. LF (\r\n)|(\r)|(\n)|(\x0c)
  49. ANY_CHAR [^\r\n\x0c]
  50. PRINT_CHAR [\x21-\x7e]
  51. /* -------------- rules section -------------- */
  52. %%
  53. <INITIAL>{SPACES1}    {BEGIN(INITIAL);}
  54. {SPACES}{LF}        {BEGIN(INITIAL);theLine++;theColumn=1;return DmanParser::TOK_LF;}
  55. \\{LF}            {BEGIN(DANS_LIGNE);theLine++;theColumn=1;}
  56.  
  57. <INITIAL>":"[Hh][eE][aA][Dd][Ee][Rr]    {BEGIN(DANS_LIGNE);return DmanParser::CMD_HEADER;}
  58. <INITIAL>":"[Ss][eE][cC][Tt][Ii][Oo][Nn]    {BEGIN(DANS_LIGNE);return DmanParser::CMD_SECTION;}
  59. <INITIAL>":"[Ss][Ss][eE][cC][Tt][Ii][Oo][Nn]    {BEGIN(DANS_LIGNE);return DmanParser::CMD_SSECTION;}
  60. <INITIAL>":"[A-Za-z0-9_]*        {BEGIN(DANS_LIGNE);return DmanParser::CMD_BAD;}
  61. <INITIAL>("-")        {BEGIN(DANS_LIGNE);return DmanParser::TOK_ITEM1;}
  62. <INITIAL>("--")        {BEGIN(DANS_LIGNE);return DmanParser::TOK_ITEM2;}
  63. <INITIAL>("---")    {BEGIN(DANS_LIGNE);return DmanParser::TOK_ITEM3;}
  64. <INITIAL>("-"+)        {BEGIN(DANS_LIGNE);return DmanParser::TOK_ITEM_BAD;}
  65. <INITIAL>(">")        {BEGIN(DANS_LIGNE);return DmanParser::TOK_INDENT1;}
  66. <INITIAL>(">>")        {BEGIN(DANS_LIGNE);return DmanParser::TOK_INDENT2;}
  67. <INITIAL>(">>>")    {BEGIN(DANS_LIGNE);return DmanParser::TOK_INDENT3;}
  68. <INITIAL>(">"+)        {BEGIN(DANS_LIGNE);return DmanParser::TOK_INDENT_BAD;}
  69.  
  70.  
  71.  
  72. \\{SPACES1}        {BEGIN(DANS_LIGNE);theValue.theChar=' ';return DmanParser::TOK_CHAR;}
  73. \\{ANY_CHAR}        {BEGIN(DANS_LIGNE);theValue.theChar=theText[1];return DmanParser::TOK_CHAR;}
  74.  
  75. {SPACES1}          {BEGIN(DANS_LIGNE);return DmanParser::TOK_SPACE;}
  76. "\""    {BEGIN(DANS_LIGNE);return DmanParser::TOK_DQUOTE;}
  77. "{"    {BEGIN(DANS_LIGNE);return DmanParser::TOK_BEGIN;}
  78. "}"    {BEGIN(DANS_LIGNE);return DmanParser::TOK_END;}
  79. "<"    {BEGIN(DANS_LIGNE);return DmanParser::TOK_INF;}
  80. ">"    {BEGIN(DANS_LIGNE);return DmanParser::TOK_SUP;}
  81.  
  82. "Θ"    {BEGIN(DANS_LIGNE);theValue.theString="e'";return DmanParser::TOK_COMPOSED2;}
  83. "╔"    {BEGIN(DANS_LIGNE);theValue.theString="E'";return DmanParser::TOK_COMPOSED2;}
  84. "Φ"    {BEGIN(DANS_LIGNE);theValue.theString="e`";return DmanParser::TOK_COMPOSED2;}
  85. "╚"    {BEGIN(DANS_LIGNE);theValue.theString="E`";return DmanParser::TOK_COMPOSED2;}
  86. "Ω"    {BEGIN(DANS_LIGNE);theValue.theString="e^";return DmanParser::TOK_COMPOSED2;}
  87. "╩"    {BEGIN(DANS_LIGNE);theValue.theString="E^";return DmanParser::TOK_COMPOSED2;}
  88. "δ"    {BEGIN(DANS_LIGNE);theValue.theString="e:";return DmanParser::TOK_COMPOSED2;}
  89. "╦"    {BEGIN(DANS_LIGNE);theValue.theString="E:";return DmanParser::TOK_COMPOSED2;}
  90. "ß"    {BEGIN(DANS_LIGNE);theValue.theString="a'";return DmanParser::TOK_COMPOSED2;}
  91. "┴"    {BEGIN(DANS_LIGNE);theValue.theString="A'";return DmanParser::TOK_COMPOSED2;}
  92. "α"    {BEGIN(DANS_LIGNE);theValue.theString="a`";return DmanParser::TOK_COMPOSED2;}
  93. "└"    {BEGIN(DANS_LIGNE);theValue.theString="A`";return DmanParser::TOK_COMPOSED2;}
  94. "Γ"    {BEGIN(DANS_LIGNE);theValue.theString="a^";return DmanParser::TOK_COMPOSED2;}
  95. "┬"    {BEGIN(DANS_LIGNE);theValue.theString="A^";return DmanParser::TOK_COMPOSED2;}
  96. "Σ"    {BEGIN(DANS_LIGNE);theValue.theString="a:";return DmanParser::TOK_COMPOSED2;}
  97. "─"    {BEGIN(DANS_LIGNE);theValue.theString="A:";return DmanParser::TOK_COMPOSED2;}
  98. "π"    {BEGIN(DANS_LIGNE);theValue.theString="a~";return DmanParser::TOK_COMPOSED2;}
  99. "├"    {BEGIN(DANS_LIGNE);theValue.theString="A~";return DmanParser::TOK_COMPOSED2;}
  100. "τ"    {BEGIN(DANS_LIGNE);theValue.theString="c,";return DmanParser::TOK_COMPOSED2;}
  101. "╟"    {BEGIN(DANS_LIGNE);theValue.theString="C,";return DmanParser::TOK_COMPOSED2;}
  102. "φ"    {BEGIN(DANS_LIGNE);theValue.theString="i'";return DmanParser::TOK_COMPOSED2;}
  103. "═"    {BEGIN(DANS_LIGNE);theValue.theString="I'";return DmanParser::TOK_COMPOSED2;}
  104. "∞"    {BEGIN(DANS_LIGNE);theValue.theString="i`";return DmanParser::TOK_COMPOSED2;}
  105. "╠"    {BEGIN(DANS_LIGNE);theValue.theString="I`";return DmanParser::TOK_COMPOSED2;}
  106. "ε"    {BEGIN(DANS_LIGNE);theValue.theString="i^";return DmanParser::TOK_COMPOSED2;}
  107. "╬"    {BEGIN(DANS_LIGNE);theValue.theString="I^";return DmanParser::TOK_COMPOSED2;}
  108. "∩"    {BEGIN(DANS_LIGNE);theValue.theString="i:";return DmanParser::TOK_COMPOSED2;}
  109. "╧"    {BEGIN(DANS_LIGNE);theValue.theString="I:";return DmanParser::TOK_COMPOSED2;}
  110. "·"    {BEGIN(DANS_LIGNE);theValue.theString="u'";return DmanParser::TOK_COMPOSED2;}
  111. "┌"    {BEGIN(DANS_LIGNE);theValue.theString="U'";return DmanParser::TOK_COMPOSED2;}
  112. "∙"    {BEGIN(DANS_LIGNE);theValue.theString="u`";return DmanParser::TOK_COMPOSED2;}
  113. "┘"    {BEGIN(DANS_LIGNE);theValue.theString="U`";return DmanParser::TOK_COMPOSED2;}
  114. "√"    {BEGIN(DANS_LIGNE);theValue.theString="u^";return DmanParser::TOK_COMPOSED2;}
  115. "█"    {BEGIN(DANS_LIGNE);theValue.theString="U^";return DmanParser::TOK_COMPOSED2;}
  116. "ⁿ"    {BEGIN(DANS_LIGNE);theValue.theString="u:";return DmanParser::TOK_COMPOSED2;}
  117. "▄"    {BEGIN(DANS_LIGNE);theValue.theString="U:";return DmanParser::TOK_COMPOSED2;}
  118. "÷"    {BEGIN(DANS_LIGNE);theValue.theString="o:";return DmanParser::TOK_COMPOSED2;}
  119. "╓"    {BEGIN(DANS_LIGNE);theValue.theString="U:";return DmanParser::TOK_COMPOSED2;}
  120. "⌠"    {BEGIN(DANS_LIGNE);theValue.theString="o^";return DmanParser::TOK_COMPOSED2;}
  121. "╘"    {BEGIN(DANS_LIGNE);theValue.theString="O^";return DmanParser::TOK_COMPOSED2;}
  122. "≥"    {BEGIN(DANS_LIGNE);theValue.theString="o`";return DmanParser::TOK_COMPOSED2;}
  123. "╥"    {BEGIN(DANS_LIGNE);theValue.theString="O`";return DmanParser::TOK_COMPOSED2;}
  124. "≤"    {BEGIN(DANS_LIGNE);theValue.theString="o'";return DmanParser::TOK_COMPOSED2;}
  125. "╙"    {BEGIN(DANS_LIGNE);theValue.theString="O'";return DmanParser::TOK_COMPOSED2;}
  126. "⌡"    {BEGIN(DANS_LIGNE);theValue.theString="o~";return DmanParser::TOK_COMPOSED2;}
  127. "╒"    {BEGIN(DANS_LIGNE);theValue.theString="O~";return DmanParser::TOK_COMPOSED2;}
  128. " "    {BEGIN(DANS_LIGNE);theValue.theString="y:";return DmanParser::TOK_COMPOSED2;}
  129. "²"    {BEGIN(DANS_LIGNE);theValue.theString="y'";return DmanParser::TOK_COMPOSED2;}
  130. "▌"    {BEGIN(DANS_LIGNE);theValue.theString="Y'";return DmanParser::TOK_COMPOSED2;}
  131. "±"    {BEGIN(DANS_LIGNE);theValue.theString="n~";return DmanParser::TOK_COMPOSED2;}
  132. "╤"    {BEGIN(DANS_LIGNE);theValue.theString="N~";return DmanParser::TOK_COMPOSED2;}
  133. "▀"    {BEGIN(DANS_LIGNE);theValue.theString="*8";return DmanParser::TOK_COMPOSED1;}
  134. "°"    {BEGIN(DANS_LIGNE);theValue.theString="o/";return DmanParser::TOK_COMPOSED2;}
  135. "╪"    {BEGIN(DANS_LIGNE);theValue.theString="O/";return DmanParser::TOK_COMPOSED2;}
  136. "µ"    {BEGIN(DANS_LIGNE);theValue.theString="*(ae";return DmanParser::TOK_COMPOSED1;}
  137. "╞"    {BEGIN(DANS_LIGNE);theValue.theString="*(Ae";return DmanParser::TOK_COMPOSED1;}
  138. "í"    {BEGIN(DANS_LIGNE);theValue.theString="*!";return DmanParser::TOK_COMPOSED1;}
  139. "┐"    {BEGIN(DANS_LIGNE);theValue.theString="*?";return DmanParser::TOK_COMPOSED1;}
  140. "σ"    {BEGIN(DANS_LIGNE);theValue.theString="ao";return DmanParser::TOK_COMPOSED2;}
  141. "┼"    {BEGIN(DANS_LIGNE);theValue.theString="Ao";return DmanParser::TOK_COMPOSED2;}
  142. "«"    {BEGIN(DANS_LIGNE);theValue.theString="*R";return DmanParser::TOK_COMPOSED1;}
  143. "⌐"    {BEGIN(DANS_LIGNE);theValue.theString="(co";return DmanParser::TOK_COMPOSED1;}
  144. "ó"    {BEGIN(DANS_LIGNE);theValue.theString="(ct";return DmanParser::TOK_COMPOSED1;}
  145. "%"[A-Z]"%"    {BEGIN(DANS_LIGNE);theValue.theChar='?';return DmanParser::TOK_CHAR;} /* mode debug parser/lexer */
  146. "%+%"        {SetDebug(1);} /* mode debug parser/lexer */
  147. "%-%"        {SetDebug(0);}
  148. "%"        {BEGIN(DANS_COMMENT);}
  149. <DANS_COMMENT>{ANY_CHAR}+    {}
  150. <DANS_COMMENT